//
//  LOLequipTableViewCell.m
//  LOLXXbox
//
//  Created by mac on 16/2/29.
//  Copyright © 2016年 Grasstrio. All rights reserved.
//

#import "LOLequipTableViewCell.h"
#define CONTENTWIDTH  self.contentView.frame.size.width
#define CONTENTHEIGHT  self.contentView.frame.size.height
#import <UIImageView+WebCache.h>
#define WIDTH [[UIScreen mainScreen]bounds].size.width
#define HEIGHT [[UIScreen mainScreen]bounds].size.height
#define EQUIPIMAGEURL(name) [NSString stringWithFormat:@"http://img.lolbox.duowan.com/zb/%@_64x64.png",name]

#import "LOLHeroequipCollectionViewCell.h"
@implementation LOLequipTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self createView];
    }
    return self;
    
}


-(void)createView
{
    
    self.titleNameLabel=[[UILabel alloc]init];
    self.titleNameLabel.font=[UIFont systemFontOfSize:15 weight:2];
    [self.contentView addSubview:self.titleNameLabel];
    
    
    self.collectionV=[[LOLBaseCollectionView alloc]initWithFrame:CGRectZero flowLayoutItemSize:CGSizeMake(CONTENTWIDTH/6,CONTENTWIDTH/6) xSpace:5 ySpace:5 sectionInSet:UIEdgeInsetsMake(0, 5, 0, 5) cell:[LOLHeroequipCollectionViewCell class] reuse:@"EquipsCCell"];
    self.collectionV.userInteractionEnabled = NO;
    self.collectionV.delegate=self;
    self.collectionV.dataSource=self;
    [self.contentView addSubview:self.collectionV];

    
    self.userInfoLabel=[[UILabel alloc]init];
    self.userInfoLabel.font=[UIFont systemFontOfSize:13];
    self.userInfoLabel.textColor=[UIColor grayColor];
    [self.contentView addSubview:self.userInfoLabel];

    
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    self.titleNameLabel.frame=CGRectMake(5,8,CONTENTWIDTH-10,CONTENTHEIGHT/5);
    self.userInfoLabel.frame=CGRectMake(5, 8+CONTENTHEIGHT/5+5, CONTENTWIDTH-10, CONTENTHEIGHT/5);
    self.collectionV.frame=CGRectMake(0, CONTENTHEIGHT/5*2+15+5, WIDTH, (CONTENTWIDTH-35)/6);
    
    
    
    
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return self.imageIdArr.count;
    
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    LOLHeroequipCollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"EquipsCCell" forIndexPath:indexPath];
    
    [cell.headImageView sd_setImageWithURL:[NSURL URLWithString:EQUIPIMAGEURL(self.imageIdArr[indexPath.row])] placeholderImage:[UIImage imageNamed:@"placeholder"]];
    return cell;
    
    
    
}


@end
